#pragma once

#include <iostream>
#include <string.h>
#include <string>

#include "common.h"

using namespace std;

class BufferQueue {
public:
	BufferQueue(int max_queue_length, string queue_id);
	~BufferQueue();

	CODEC_ERROR initQueue();
	CODEC_ERROR enQueue(unsigned char* buffer, int length);
	CODEC_ERROR rewind(int offset);
	CODEC_ERROR deQueue(unsigned char* buffer, int length);
	CODEC_ERROR queueLength(int &length);

	unsigned char* getData();
	int getHead();
	int getTail();

private:
	unsigned char *m_buffer;
	int head;
	int tail;

	int m_max_queue_length;
	string m_queue_id;
};
